#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import json

def make_compile():
    return [{
		"cmd": "compile",
		"sourceId": 0,
		"langs": {
			"g++": {
			},
			"java": {
			}
		}
	}]


def make_case(file_name, case_id, time_limit, memory_limit):
    in_file = "data/%s%d.in" % (file_name, case_id)
    ans_file = "data/%s%d.ans" % (file_name, case_id)
    return [{
		"cmd": "exec",
		"binId": 0,
		"timeLimit": str(time_limit),
		"memLimit": str(memory_limit),
		"inputFile": in_file
	}, {
		"cmd": "judge",
		"ansId": case_id * 2 - 1,
		"checker": "source/spj",
		"inputFile": [ in_file ],
		"stdOutputFile": ans_file
	}]
 
def make_all(file_name, cases, time_limit, memory_limit):
    tus = list()
    tus += make_compile()
    for i in range(1, cases + 1):
        tus += make_case(file_name, i, time_limit, memory_limit)
    return json.dumps(tus)
    
if __name__ == "__main__":
    print(make_all("ticket_chooser", 10, 2000, 2048))
